package com.allen.retrofit2_rxjava2.view.selectImage.view;

import android.app.Dialog;
import android.content.Context;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.widget.LinearLayout;
import android.widget.RelativeLayout;
import android.widget.TextView;

import com.allen.retrofit2_rxjava2.R;


/**
 * 新建群组上传图像的dialog
 * 
 * @author Administrator
 * 
 */
public class UpLoadImgDialog extends Dialog {

	public UpLoadImgDialog(Context context, View.OnClickListener itemsOnClick) {
		super(context, R.style.ActionSheet);

		LayoutInflater inflater = (LayoutInflater) context.getSystemService(Context.LAYOUT_INFLATER_SERVICE);
		LinearLayout layout = (LinearLayout) inflater.inflate(R.layout.dialog_upload_img, null);
		final int cFullFillWidth = 10000;
		layout.setMinimumWidth(cFullFillWidth);

		TextView cameraTv = (TextView) layout.findViewById(R.id.tv_dialog_camera);
		cameraTv.setOnClickListener(itemsOnClick);
		TextView galleryTv = (TextView) layout.findViewById(R.id.tv_dialog_gallery);
		galleryTv.setOnClickListener(itemsOnClick);
		TextView cancelTv = (TextView) layout.findViewById(R.id.tv_dialog_cancel);
		cancelTv.setOnClickListener(new View.OnClickListener() {
			public void onClick(View v) {
				dismiss();
			}
		});

		WindowManager.LayoutParams lp = getWindow().getAttributes();
		lp.x = 0;
		final int cMakeBottom = -1000;
		lp.y = cMakeBottom;
		lp.gravity = Gravity.BOTTOM;
		onWindowAttributesChanged(lp);
		setCanceledOnTouchOutside(false);
		setContentView(layout);
	}

}
